﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CardDemand.aspx.cs" Inherits="CardLogistics.Web.MainPage.SelectPage.CardDemand" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>卡片需求单</title>
    <link href="../../css/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../js/jquery.js"></script>
    <link href="../../js/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
    <script src="../../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
</head>
<body>
    <form runat="server" id="f2">
        <div class="rightinfo">

            <ul class="seachform">
                <li>
                    <label>
                        编号/申请人</label><asp:TextBox ID="txt_NOName" runat="server" CssClass="scinput" Width="100px"></asp:TextBox>
                </li>
                <li>
                    <label>
                        申请日期</label><asp:TextBox ID="txt_ApplyStartData" runat="server" CssClass="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                            Width="100px"></asp:TextBox>&nbsp;至
                    <asp:TextBox ID="txt_ApplyEndData" runat="server" CssClass="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                        Width="100px"></asp:TextBox>
                </li>
                <li>
                    <label>
                        需卡日期</label><asp:TextBox ID="txt_DemandStartData" runat="server" CssClass="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                            Width="100px"></asp:TextBox>&nbsp;至
                    <asp:TextBox ID="txt_DemandEndData" runat="server" CssClass="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"
                        Width="100px"></asp:TextBox>
                </li>
                <li>
                    <label>
                        &nbsp;</label>
                    <asp:Button ID="btn_Search" runat="server" Text="查询" CssClass="scbtn" OnClick="btn_Search_Click" /></li>
            </ul>

            <asp:Repeater ID="rptList" runat="Server">
                <HeaderTemplate>
                    <table class="tablelist">
                        <thead>
                            <tr>
                                <th>选择
                                </th>
                                <th>单据编号
                                </th>
                                <th>申请人
                                </th>
                                <th>卡片类型
                                </th>
                                <th>申请日期
                                </th>
                                <th>需卡日期
                                </th>
                                <th>需求总数(张)
                                </th>
                                <th>已出库数量(张)
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td align="center" width="70px">
                            <a href="#" onclick="ReturnSelData('<%# Eval("detailid")%>','<%# Eval("DEMANDNO")%>','<%# Eval("cardnumber")%>','<%# Eval("CardOutTotal")%>','<%# Eval("CardType")%>','<%# Eval("CardTypeName")%>');" style="color: Blue;">选择</a>
                        </td>
                        <td align="center">
                            <%# Eval("DEMANDNO")%>
                        </td>
                        <td align="center">
                            <%# Eval("APPLICANT")%>
                        </td>
                        <td align="center">
                            <%# Eval("cardtypename")%>
                        </td>
                        <td align="center">
                            <%# Eval("APPLICADATE") !=null? DateTime.Parse(Eval("APPLICADATE").ToString()).ToString("yyyy-MM-dd"):""%>
                        </td>
                        <td align="center">
                            <%# Eval("CARDDATE") != null ? DateTime.Parse(Eval("CARDDATE").ToString()).ToString("yyyy-MM-dd") : ""%>
                        </td>
                        <td align="right">
                            <%# Eval("cardnumber")%>
                        </td>
                        <td align="right">
                            <%# Eval("CardOutTotal")%>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    </tbody></table>
                </FooterTemplate>
            </asp:Repeater>
            <webdiyer:AspNetPager ID="AspNetPager1" CssClass="paginator" CurrentPageButtonClass="cpb"
                runat="server" Width="100%" AlwaysShow="True" FirstPageText="首页" LastPageText="尾页"
                NextPageText="下一页" PageSize="10" PrevPageText="上一页" ShowCustomInfoSection="left"
                ShowInputBox="Never" CustomInfoTextAlign="Left" LayoutType="Table" OnPageChanged="AspNetPager1_PageChanged">
            </webdiyer:AspNetPager>
            <asp:HiddenField ID="hdfDelete" runat="server" />
        </div>
        <script type="text/javascript">
            $('.tablelist tbody tr:odd').addClass('odd');

            function ReturnSelData(id, DemandNO, cardnumber, CardOutTotal, cardtype, cardtypename) {
                //返回：[0]卡片需求单详细ID [1]卡片需求单编号 [2]卡片需求总数
                parent.document.getElementById("hf_DemandId").value = id; //卡片需求单详细ID
                parent.document.getElementById("DemandNO").value = DemandNO; //卡片需求单编号
                if (parent.document.getElementById("hf_DemSum") != undefined)
                    parent.document.getElementById("hf_DemSum").value = cardnumber; //卡片需求总数
                if (parent.document.getElementById("hf_DemCkSum") != undefined)
                    parent.document.getElementById("hf_DemCkSum").value = CardOutTotal; //已出库数量

                if (parent.document.getElementById("hf_CardType") != undefined)
                    parent.document.getElementById("hf_CardType").value = cardtype; //卡片类型Id
                if (parent.document.getElementById("btn_DemandId") != undefined)
                    parent.document.getElementById("btn_DemandId").click();

                if (parent.document.getElementById("lblCardType") != undefined) {
                    alert(cardtypename);
                    parent.document.getElementById("lblCardTypes").innerHTML = cardtypename; //卡片类型Name
                }
              
                window.parent.$.tipsWindow.removeBox();
            }
        </script>
    </form>
</body>
</html>
